<nav class="navbar user-info-navbar" role="navigation">
    <!-- Left links for user info navbar -->
    <ul class="user-info-menu left-links list-inline list-unstyled">

        <li class="hidden-sm hidden-xs">
            <a href="#" data-toggle="sidebar">
                <i class="fa-bars"></i>
            </a>
        </li>
        <li class="dropdown hover-line">
            <a href="#" data-toggle="dropdown">
                <i class="fa-bell-o"></i>
                <span class="badge badge-purple" id="unpaidOrder0">0</span>
            </a>

            <ul class="dropdown-menu notifications">
                <li class="top">
                    <p class="small">
                        <a href="#" class="pull-right"></a>
                        您有 <strong id="unpaidOrder1">0</strong> 个待确认收款订单
                    </p>
                </li>

                <li>
                    <ul class="dropdown-menu-list list-unstyled ps-scrollbar" id="detail_tip">
                        <li class="active notification-success">
                            <a href="#">
                                加载中...
                            </a>
                        </li>
                    </ul>
                </li>

                <!--<li class="external">
                    <a href="#">
                        <span>查看所有订单</span>
                        <i class="fa-link-ext"></i>
                    </a>
                </li>-->
            </ul>
        </li>

    </ul>


    <!-- Right links for user info navbar -->
    <ul class="user-info-menu right-links list-inline list-unstyled">

        *{<li class="search-form"><!-- You can add "always-visible" to show make the search input visible -->}*

            *{<form method="get" action="extra-search.html">}*
                *{<input type="text" name="s" class="form-control search-field" placeholder="Type to search..." />}*

                *{<button type="submit" class="btn btn-link">}*
                    *{<i class="linecons-search"></i>}*
                *{</button>}*
            *{</form>}*

        *{</li>}*

        <li class="dropdown user-profile">
            <a href="#" data-toggle="dropdown">
                <img src="/public/images/user-4.png" alt="user-image" class="img-circle img-inline userpic-32" width="28" />
                <span>
                    *{管理员}*
                    ${adminUser?.name}
                    <i class="fa-angle-down"></i>
                </span>
            </a>

            <ul class="dropdown-menu user-profile-menu list-unstyled">
                *{<li>}*
                    *{<a href="#settings">}*
                        *{<i class="fa-wrench"></i>}*
                        *{个人设置}*
                    *{</a>}*
                *{</li>}*
                <li>
                    <a href="#" onclick="updatePssWord()">
                        <i class="fa-wrench"></i>
                        修改密码
                    </a>
                </li>

                <li class="last">
                    <a href="/logout">
                        <i class="fa-lock"></i>
                        退出
                    </a>
                </li>
            </ul>
        </li>

        *{<li>}*
            *{<a href="#" data-toggle="chat">}*
                *{<i class="fa-comments-o"></i>}*
            *{</a>}*
        *{</li>}*

    </ul>

</nav>

<script>

    $(function(){
        getUnPaidOrder();
    });

    function getUnPaidOrder(){
        $.ajax({
            url:'/BS0017/admin/order/countPaidUnConfirm',
            type:'GET',
            async:true,
            timeout:5000,
            dataType:'json',
            success:function(data){
                $("#unpaidOrder0").html(data.msg);
                $("#unpaidOrder1").html(data.msg);

                //alert(data.items);

                eval("var items ="+data.items);
                if(items != null && items.length > 0){
                    $("#detail_tip").html("");
                    for(var i = 0 ; i < items.length ; i ++){
                        var li = $("<li class=\"active notification-success\"></li>");
                        $("#detail_tip").append(li);

                        var alink = $("<a href=\"/BS0023/admin/order/detail/"+items[i].id+"/1\"></a>");
                        li.append(alink);

                        alink.html("<i class=\"fa-user\"></i><span class=\"line\"><strong>"+items[i].orderTime+"&nbsp;&nbsp;"+items[i].webuser+"&nbsp;&nbsp;"+items[i].orderContent+"</strong></span><span class=\"line small time\">"+items[i].orderTime2+"</span>");
                    }
                }

                setTimeout("getUnPaidOrder()", 60*1000);
            }
        })
    }

    //显示修改密码页面
    function updatePssWord() {
        $('#id_admin_user_password').val('');
        $('#re_admin_user_password').val('');
        $('#id_update_password').modal('show');
    }

    //保存修改的密码
    function savePassWord() {
        var passWord = $('#id_admin_user_password').val();
        var rePassWord = $('#re_admin_user_password').val();
        if(passWord == null || passWord == ''){
            layer.msg('请输入密码!');
            return;
        }
        if(rePassWord == null || rePassWord == ''){
            layer.msg('请确认密码!');
            return;
        }
        if(passWord != rePassWord){
            layer.msg('两次密码不一致,请确认!');
            return;
        }

        $.getJSON('/basic/LoginCtrl/passwordChange',{password: passWord},function (data) {
            if(data){
                layer.msg('密码修改成功!');
                $('#id_update_password').modal('hide');

            }else {
                layer.msg('未获取到登录用户信息,密码修改失败!');
                $('#id_update_password').modal('hide');

            }

        })

    }

</script>